Repository navigation
feat(plugins): add workspace/setDirectoryTypes and workspace/setDirectoryMarks host API - #215
Merged
Merged
Conversation
xiaoyumuxi
marked this pull request as ready for review
November 27, 2026 16:48
36 tasks done
- 插件 RPC 的图标白名单与解析器一致(去掉 module/package),名称不能只含空白, 标记路径不能含 `\` 或 `:`;新增测试证明 RPC 接受的登记一定能被解析器接受, 宿主保存的单个插件登记不会让整次目录解析失败 - 解析器校验插件类型图标;插件类型、标记按派生顺序排序,同 ID 冲突时排序靠前的插件胜出 - 目录规则 fixture 新增 resolve 用例:插件层位于共享与 glob 之间、paths 省略时显式排除 仍生效,并补充非法输入用例 - 契约 README、rust-core-api 文档补全替换语义、租约、优先级、路径与图标规则、权限说明 - 更新记录链接 #215;Go/Rust SDK 格式化
This was referenced Nov 27, 2026
Open
xiaoyumuxi
added a commit
that referenced
this pull request
Nov 28, 2026
xiaoyumuxi
added a commit
that referenced
this pull request
Nov 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述 / Summary
为插件后端补齐目录类型与动态目录标记扩展能力(Phase 2),在
pluginAPIVersion: 0/litheFunctions: 0内兼容新增两个宿主方法与一个独立权限,不提升任何能力版本、协议版本或 SDK 版本。宿主方法 / Host methods
workspace/setDirectoryTypesid以plugin.开头)workspace/setDirectoryMarks.gitignore主要改动 / Changes
rust/crates/plugin-rpc/src/lib.rs、shared/plugins/contract/v1/plugin-manifest.schema.json:新增权限workspace.directoryMarks。rust/crates/plugin-rpc/src/host_requests.rs、rust/crates/plugin-rpc/src/workflow.rs:注册并严格校验lithe/host/workspace/setDirectoryTypes与lithe/host/workspace/setDirectoryMarks的参数、字段白名单、上限、plugin.*ID 规范、工作区相对路径与#rrggbb颜色。rust/crates/project/src/directory_actions.rs:workspace.resolveDirectoryPresentation新增可选字段pluginTypes与pluginMarks,输出新增可选字段pluginId,按user > shared > plugin > glob > vcs > plain确定性合并呈现与manualExcludedDirectories;workspace.reduceDirectoryAction的setRole支持用户手动分配plugin.*类型。shared/plugins/contract/v1/README.md、shared/plugins/reference/api-catalog.md(中英双表)、shared/plugins/reference/protocol-changelog.md。index.d.ts) / Java 四个官方 SDK 同步封装setDirectoryTypes与setDirectoryMarks。版本变化说明
pluginAPIVersion: 不变(0)schemaVersion: 不变(0)requires各能力版本与litheFunctions协议版本: 均不变(0),采用兼容的可选字段与新权限独立授权方法,宿主通过getCapabilities声明可用性。评审修正(
914fed28)/ Review fixes桌面端 1lck/Lithe-IDEA#2480 接入时发现:RPC 接受的登记,解析器可能拒绝,一个插件的非法类型会让整次目录解析失败、连带用户和其他插件的排除都不生效。本提交让两边一致:
rust/crates/plugin-rpc/src/workflow.rs:图标白名单与解析器一致(去掉module、package);名称不能只含空白;标记路径不能含\或:。rust/crates/project/src/directory_actions.rs:解析器也校验插件类型图标;插件类型和标记按派生顺序排序后合并,同 ID 冲突时排序靠前的插件胜出,结果与登记顺序无关。rust/crates/core/src/tests/directory_actions.rs:新增测试证明 RPC 接受的登记一定能被解析器接受,宿主保存的单个插件登记不会让整次解析失败。rust/fixtures/workspace/directory-rules-v1.json:新增 resolve 用例(插件层在共享与 glob 之间;paths省略时显式排除仍生效)和非法输入用例。shared/plugins/contract/v1/README.md、rust/contracts/rust-core-api.md:补全替换语义、租约、优先级、路径与图标规则、权限说明;protocol-changelog.md链接本 PR。使用方 / Consumers
914fed28。go.mod目录标成源代码根目录),Rust SDK 固定914fed28。两者都要在本 PR 合入后改为固定 main 上的合入提交。
验证 / Verification
本机 macOS(Apple Silicon),提交
914fed28:cargo fmt --manifest-path rust/Cargo.toml --all --check、cargo fmt --manifest-path shared/plugins/sdk/rust/Cargo.toml --all --check:通过;gofmt -l shared/plugins/sdk/go/:无输出cargo clippy -p lithe-project -p lithe-plugin-rpc -p lithe-core --all-targets -- -D warnings:通过,无警告cargo test -p lithe-project -p lithe-plugin-rpc -p lithe-core:通过(lithe-core 947、lithe-project 104、lithe-plugin-rpc 43)bash scripts/rust-core/verify-rust-core-comments.sh:通过node scripts/rust-core/verify-platform-tests.mjs:通过(53 个 crate 的测试都在 CI 主机上运行)node shared/plugins/scripts/verify-docs.mjs:通过node shared/plugins/scripts/sdk-e2e.mjs:通过914fed28):11 项检查全部通过(Select crates、Linux、macOS、Windows、Rust Core gate、Contract and docs、Rust/Go/Node.js/Java SDK、SDK end-to-end with Rust Core)desktop/internal/workbench、pluginservice、core、settingswindow全量测试通过没有在本机 Windows 上运行,Windows 只有 CI 结果。